# 基础镜像
#FROM adoptopenjdk/openjdk11:alpine-jre
#FROM openjdk:11.0.16
#FROM openjdk:11.0.16-jre-slim
#FROM openjdk:8u212-jre-alpine3.9
FROM registry.cn-beijing.aliyuncs.com/wangxiaochun/openjdk:8u212-jre-alpine3.9

# 作者
LABEL MAINTAINER="wangxiaochun<root@wangxiaochun.com>"

ENV APP_NAME=ruoyi APP_PATH=/data/ruoyi  APP_PORT=80

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories && apk update && apk --no-cache add tzdata && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

# 挂载目录
VOLUME ${APP_PATH}

# 创建目录
RUN mkdir -p ${APP_PATH}

# 指定路径
WORKDIR  ${APP_PATH}

# 复制jar文件到路径
COPY ./ruoyi-admin/target/*.jar ${APP_PATH}/${APP_NAME}.jar
#COPY ./target/*.jar ${APP_PATH}/${APP_NAME}.jar

#暴露端口
EXPOSE $APP_PORT

# 启动服务
CMD java -jar ${APP_PATH}/${APP_NAME}.jar --server.port=$APP_PORT

#安装字体相关包，否则无法显示验证码
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories && apk update && apk  --no-cache add ttf-dejavu fontconfig
